package com.liz.lizrpccore.configs;

import com.liz.lizrpccore.properties.MyRedisProperties;
import com.liz.lizrpccore.templates.MyRedisTemplate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author liangGongWei
 * @description
 * @create 2021-08-05 21:39
 **/

@Slf4j
@Configuration
@EnableConfigurationProperties(MyRedisProperties.class)
@ConditionalOnProperty(prefix = "liz.redis", name = "host", matchIfMissing = false)
public class MyRedisAutoConfig {

    @Bean
    public MyRedisTemplate myRedisTemplate(MyRedisProperties redisProperties){
        return new MyRedisTemplate(redisProperties);
    }

}
